package com.ssy.lingxi.report.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 售后退货处理请操作类型枚举
 * @author 伍将
 * @date 2020/11/20
 * @version 2.0.0
 */
public enum AfterSaleReturnHandleOperateTypeEnum {

    /**
     * 待提交审核退货申请单
     */
    TO_BE_VALIFY_COMMIT(1, "待提交审核退货申请单", "/memberCenter/afterService/returnManage/returnPrSubmit"),
    /**
     * 待审核退货申请单（一级）
     */
    TO_BE_VALIFY_STEP1(2, "待审核退货申请单（一级）", "/memberCenter/afterService/returnManage/returnPr1"),
    /**
     * 待审核退货申请单（二级）
     */
    TO_BE_VALIFY_STEP2(3, "待审核退货申请单（二级）", "/memberCenter/afterService/returnManage/returnPr2"),
    /**
     * 待确认退货申请单
     */
    TO_BE_CONFIRM(4, "待确认退货申请单", "/memberCenter/afterService/returnManage/returnPrConfirm"),
    /**
     * 待新增退货入库单
     */
    TO_BE_ADD_STORAGE(5, "待新增退货入库单", "/memberCenter/afterService/returnManage/returnPrAddWarehousing"),
    /**
     * 待退货收货
     */
    TO_BE_RECEIVE(6, "待退货收货", "/memberCenter/afterService/returnManage/returnPrReceived"),
    /**
     * 待退款
     */
    TO_BE_REFUND(7, "待退款", "/afterService/returnManage/returnPrReturn");

    /**
     * 编码
     */
    private final Integer code;
    /**
     * 名称
     */
    private final String name;
    /**
     * 链接
     */
    private final String link;


    AfterSaleReturnHandleOperateTypeEnum(Integer code, String name, String link) {
        this.code = code;
        this.name = name;
        this.link = link;
    }

    public static AfterSaleReturnHandleOperateTypeEnum getEnum(Integer code) {
        return Arrays.stream(AfterSaleReturnHandleOperateTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }


    public Integer getCode() {
        return code;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public String getLink() {
        return link;
    }
}
